
import {Menu,Tray,app} from 'electron';
import path from 'path'
// 托盘-写法
let contextMenu=null; 
export const createTray = (win)=>{
     if(contextMenu) return contextMenu;
     contextMenu = Menu.buildFromTemplate([
        {
            label: '显示',
            click: () => {
                 win.show();
            }
        }, {
            label: '退出',
            click: () => {
                app.quit()
            }
        }
    ])
    const trayIco = path.resolve(__dirname, '../../../public/favicon.ico')
    const tary = new Tray(trayIco);
    tary.setContextMenu(contextMenu);
    tary.setToolTip('app')
}